<template>
  <div class="app-container">
    <PageContent ref="contentRef" :content-config="contentConfig" @addClick="handleAddClick"
      @edit-click="handleEditClick" @export-click="handleExportClick" @toolbarClick="handleToolbarClick"
      @operat-click="handleOperatClick">
    </PageContent>
    <!-- 新增 -->
    <page-modal ref="addModalRef" :modal-config="addModalConfig" @submit-click="handleSubmitClick" />

    <!-- 编辑 -->
    <page-modal ref="editModalRef" :modal-config="editModalConfig" @submit-click="handleSubmitClick" />
  </div>
</template>

<script setup>
import contentConfig from "./config/content";
import addModalConfig from "./config/add";
import editModalConfig from "./config/edit";
import usePage from "@/hooks/usePage";
import { onMounted } from "vue";
import Api from '@/api/system/power'
defineOptions({
  name: "systemPower",
  inheritAttrs: false,
});
const { searchRef, contentRef, addModalRef, editModalRef,
  handleQueryClick, handleResetClick, handleAddClick,
  handleSubmitClick, handleExportClick, } = usePage();
const handleEditClick = async (row) => {
  const { data } = await Api.get(row.id)
  editModalRef.value?.setModalVisible(data);
}
// Api.get()
const changeAdd = (obj) => {
  addModalRef.value?.setModalVisible(obj);
}
onMounted(() => {
})
</script>

<style></style>